﻿@{
    ViewBag.Title = "StaticPropertyInstance";
    Layout = "~/Views/Shared/_Page.cshtml";
}

<h2>Static Property Instance</h2>

<script type="text/javascript">
    function Universe() {
        // do we have an existing instance?
        if (typeof Universe.instance === "object") {
            return Universe.instance;
        }

        // proceed as normal
        this.start_time = 0;
        this.bang = "Big";

        // cache
        Universe.instance = this;

        // implicit return:
        //return this;
    }

    window.onload = function () {
        // testing
        var uni = new Universe();
        var uni2 = new Universe();
        ZEUS.DEBUG.log("uni === uni2:");
        ZEUS.DEBUG.log(uni === uni2);
        ZEUS.DEBUG.log("uni == uni2: ");
        ZEUS.DEBUG.log(uni == uni2); 
    }
</script>
